﻿using AutoTest.Business.Dto.Common.Setting;
using AutoTest.Business.Vo.Common;
using AutoTest.Domain.Entities;
using AutoTest.Framework.Pager;

namespace AutoTest.Business.IServices.Common
{
    /// <summary>
    /// 配置访问的service
    /// </summary>
    public interface ISettingService
    {

        /// <summary>
        /// 获取所有配置
        /// </summary>
        /// <returns></returns>
        Task<List<SettingVo>> GetSettingsAsync();

        /// <summary>
        /// 分页查询系统配置
        /// </summary>
        /// <param name="searchParams"></param>
        /// <returns></returns>
        Task<PagedList<Setting>> GetSettingPagerAsync(SettingPageSearchDto searchParams);

        /// <summary>
        /// 根据Key获取配置
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        Task<SettingVo> GetSettingByKeyAsync(string key);

        /// <summary>
        /// 根据key获取value值
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        Task<string> GetSettingValueAsync(string key, string defaultValue = "");
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="optionKey"></param>
        /// <returns></returns>
        Task<T> GetSettingOptionAsync<T>(string optionKey);

    }
}
